package org.example.javaweb.controller.admin;


import jakarta.servlet.http.HttpSession;
import org.example.javaweb.entity.User;
import org.example.javaweb.service.admin.UserManagementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@RestController
//@CrossOrigin
@RequestMapping("/UserManagement")
public class UserManagementController {

    @Autowired
    private UserManagementService userManagementService;

    @RequestMapping("/addUser")
    public boolean addUser(@RequestBody User user) {
        return userManagementService.addUser(user);
    }

    @RequestMapping("/findUserByName")
    public User findUserByName(@RequestBody User user) {
        return userManagementService.findUserByName(user);
    }

    @RequestMapping("/findAllUsers")
    public List<User> findAllUsers() {
        return userManagementService.findAllUsers();
    }
}
